var xmlHttp;
var page=0;
var keyId=getCookie('userId');
var local="http://47.104.10.151";

function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=")
        if (c_start!=-1)
        {
            c_start=c_start + c_name.length+1
            c_end=document.cookie.indexOf(";",c_start)
            if (c_end==-1) c_end=document.cookie.length
            return unescape(document.cookie.substring(c_start,c_end))
        }
    }
    return ""
}



function print(order_id) {
    window.location.href = "./Print.html?order_id="+order_id
}


// 订单的id；
var order_id1;
var order_id2;
var order_id3;
var order_id4;
var order_id5;
var order_id6;
//订单编号
var Order_code1;
var Order_code2;
var Order_code3;
var Order_code4;
var Order_code5;
var Order_code6;

var total1;
var total2;
var total3;
var total4;
var total5;
var total6;
var sellerId1;
var sellerId2;
var sellerId3;
var sellerId4;
var sellerId5;
var sellerId6;

var buyerId1;
var buyerId2;
var buyerId3;
var buyerId4;
var buyerId5;
var buyerId6;






function creatxmlHTTP() {
    if(window.XMLHttpRequest){
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
        xmlHttp=new XMLHttpRequest();
    }else {
        // IE6, IE5 浏览器执行代码
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    return xmlHttp;
}
function getInvite() {
    var kid=getCookie('userId');
    var url = local+":8080/login/displayCompany_Code";
    var xmlHttp = creatxmlHTTPInvite();
    var txt = "";//用于存储拼接字符串；
    //获取数据
    //拼接字符
    txt = "user_Id=" + kid;
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    function creatxmlHTTPInvite() {
        if(window.XMLHttpRequest){
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
            xmlHttp=new XMLHttpRequest();
        }else {
            // IE6, IE5 浏览器执行代码
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }

        return xmlHttp;
    }
    xmlHttp.onreadystatechange=function()
    {
        if (xmlHttp.readyState==4 && xmlHttp.status==200)
        {
            var result=xmlHttp.responseText;
            var json=eval("("+result+")");
            document.getElementById("invite_code").value=json.msg;
        }
    }
}

function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=")
        if (c_start!=-1)
        {
            c_start=c_start + c_name.length+1
            c_end=document.cookie.indexOf(";",c_start)
            if (c_end==-1) c_end=document.cookie.length
            return unescape(document.cookie.substring(c_start,c_end))
        }
    }
    return ""
}

function onClickAjax1() {
    function creatxmlHTTP321() {
        if(window.XMLHttpRequest){
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
            xmlHttp=new XMLHttpRequest();
        }else {
            // IE6, IE5 浏览器执行代码
            xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
        }
        return xmlHttp;
    }
    //获取用户id
    var keyId=getCookie('userId');
    var xmlHttp1 = creatxmlHTTP321();
    var txt = "";//用于存储拼接字符串；
    var url=local+":8080/stockorder/getbuyStock";
    //拼接字符
    txt = "user_id=" + keyId + "&page=" + page;
    xmlHttp1.open("POST", url, true);
    xmlHttp1.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp1.send(txt);

    xmlHttp1.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var result = xmlHttp.responseText;
            var json = eval("(" + result + ")");

            totalPages=json.data.totalPages;

            var input1 = document.getElementsByName("Bid1");
            if (json.data.content[0].tax_status == 0) {
                input1[10].value = "无税率";
            } else if(json.data.content[0].tax_status == 1){
                input1[11].value = "17%";
            }
            order_id1=json.data.content[0].keyId;
            input1[0].value = json.data.content[0].order_code;
            input1[1].value = 1;
            input1[2].value = json.data.content[0].product_name;
            input1[3].value = json.data.content[0].product_model;
            input1[4].value = json.data.content[0].size;
            input1[5].value = json.data.content[0].brand;
            input1[6].value = json.data.content[0].sale_price;
            input1[7].value = json.data.content[0].product_qty;
            sellerId1=json.data.content[0].seller_Id;
            buyerId1=json.data.content[0].buyer_Id;
            Order_code1=json.data.content[0].order_code;
            var sale1=json.data.content[0].sale_price;
            var num1=json.data.content[0].product_qty;
            total1=num1*sale1;

            input1[8].value = total1;
            input1[9].value = json.data.content[0].area;
            input1[12].value = json.data.content[0].order_status;

            
            var input2 = document.getElementsByName("Bid2");
            if (json.data.content[1].tax_status == 0) {
                input2[10].value = "无税率";
            } else if(json.data.content[1].tax_status == 1){
                input2[11].value = "17%";
            }
            order_id2=json.data.content[1].keyId;
            input2[0].value = json.data.content[1].order_code;
            input2[1].value = 2;
            input2[2].value = json.data.content[1].product_name;
            input2[3].value = json.data.content[1].product_model;
            input2[4].value = json.data.content[1].size;
            input2[5].value = json.data.content[1].brand;
            input2[6].value = json.data.content[1].sale_price;
            input2[7].value = json.data.content[1].product_qty;
            sellerId2=json.data.content[1].seller_Id;
            buyerId2=json.data.content[1].buyer_Id;
            Order_code2=json.data.content[1].order_code;
            var sale2=json.data.content[1].sale_price;
            var num2=json.data.content[1].product_qty;
             total2=num2*sale2;
            input2[8].value = total2;

            input2[9].value = json.data.content[1].area;
            input2[12].value = json.data.content[1].order_status;

            var input3 = document.getElementsByName("Bid3");
            if (json.data.content[2].tax_status == 0) {
                input3[10].value = "无税率";
            } else if(json.data.content[2].tax_status == 1){
                input3[11].value = "17%";
            }
           order_id3=json.data.content[2].keyId;
            input3[0].value = json.data.content[2].order_code;
            input3[1].value = 3;
            input3[2].value = json.data.content[2].product_name;
            input3[3].value = json.data.content[2].product_model;
            input3[4].value = json.data.content[2].size;
            input3[5].value = json.data.content[2].brand;
            input3[6].value = json.data.content[2].sale_price;
            input3[7].value = json.data.content[2].product_qty;
            Order_code3=json.data.content[2].order_code;
            var sale3=json.data.content[2].sale_price;
            var num3=json.data.content[2].product_qty;
             total3=num3*sale3;
            input3[8].value = total3;
            input3[9].value = json.data.content[2].area;
            input3[12].value = json.data.content[2].order_status;
            sellerId3=json.data.content[2].seller_Id;
            buyerId3=json.data.content[2].buyer_Id;
            var input4 = document.getElementsByName("Bid4");
            if (json.data.content[3].tax_status == 0) {
                input4[10].value = "无税率";
            } else if(json.data.content[3].tax_status == 1){
                input4[11].value = "17%";
            }
            order_id4=json.data.content[3].keyId;
            input4[0].value = json.data.content[3].order_code;
            input4[1].value = 4;
            input4[2].value = json.data.content[3].product_name;
            input4[3].value = json.data.content[3].product_model;
            input4[4].value = json.data.content[3].size;
            input4[5].value = json.data.content[3].brand;
            input4[6].value = json.data.content[3].sale_price;
            input4[7].value = json.data.content[3].product_qty;
            var sale4=json.data.content[3].sale_price;
            var num4=json.data.content[3].product_qty;
            Order_code4=json.data.content[3].order_code;
             total4=num4*sale4;
            input4[8].value = total4;
            input4[9].value = json.data.content[3].area;
            input4[12].value = json.data.content[3].order_status;
            sellerId4=json.data.content[3].seller_Id;
            buyerId4=json.data.content[3].buyer_Id;

            var input5 = document.getElementsByName("Bid5");
            if (json.data.content[4].tax_status == 0) {
                input5[10].value = "无税率";
            } else if(json.data.content[4].tax_status == 1){
                input5[11].value = "17%";
            }
            order_id5=json.data.content[4].keyId;
            input5[0].value = json.data.content[4].order_code;
            input5[1].value = 5;
            input5[2].value = json.data.content[4].product_name;
            input5[3].value = json.data.content[4].product_model;
            input5[4].value = json.data.content[4].size;
            input5[5].value = json.data.content[4].brand;
            input5[6].value = json.data.content[4].sale_price;
            input5[7].value = json.data.content[4].product_qty;
            var sale5=json.data.content[4].sale_price;
            var num5=json.data.content[4].product_qty;
            Order_code5=json.data.content[4].order_code;
             total5=num5*sale5;
            input5[8].value = total5;
            input5[9].value = json.data.content[4].area;
            input5[12].value = json.data.content[4].order_status;
            sellerId5=json.data.content[4].seller_Id;
            buyerId5=json.data.content[4].buyer_Id;

            var input6 = document.getElementsByName("Bid6");
            if (json.data.content[5].tax_status == 0) {
                input6[10].value = "无税率";
            } else if(json.data.content[5].tax_status == 1){
                input6[11].value = "17%";
            }
            order_id6=json.data.content[5].keyId;
            input6[0].value = json.data.content[5].order_code;
            input6[1].value = 6;
            input6[2].value = json.data.content[5].product_name;
            input6[3].value = json.data.content[5].product_model;
            input6[4].value = json.data.content[5].size;
            input6[5].value = json.data.content[5].brand;
            input6[6].value = json.data.content[5].sale_price;
            input6[7].value = json.data.content[5].product_qty;
            Order_code6=json.data.content[5].order_code;
            var sale6=json.data.content[5].sale_price;
            var num6=json.data.content[5].product_qty;
            total6=num6*sale6;
            input6[8].value = total6;
            input6[9].value = json.data.content[5].area;
            input6[12].value = json.data.content[5].order_status;
            sellerId6=json.data.content[5].seller_Id;
            buyerId6=json.data.content[5].buyer_Id;
        }
    }
}

function goBack()
{
    var KeyId=document.cookie.split(";")[0].split("=")[0];
    alert(KeyId);
}





function comfirmPro1() {

    var xmlHttp = creatxmlHTTP1();
    //获取主页的用户
    var txt="";//拼接字符串；
    txt="order_id="+order_id1;
    var url = local+":8080/stockorder/orderChangeTo3";//服务器URL
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    alert("订单已收货");

}
function comfirmPro2() {

    var xmlHttp = creatxmlHTTP1();
    //获取主页的用户
    var txt="";//拼接字符串；
    txt="order_id="+order_id2;
    var url = "http://47.104.10.151:8080/stockorder/orderChangeTo3";//服务器URL
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    alert("订单已收货");
}
function comfirmPro3() {

    var xmlHttp = creatxmlHTTP1();
    //获取主页的用户
    var txt="";//拼接字符串；
    txt="order_id="+order_id3;
    var url = local+":8080/stockorder/orderChangeTo3";//服务器URL
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    alert("订单已收货");
}
function comfirmPro4() {

    var xmlHttp = creatxmlHTTP1();
    //获取主页的用户
    var txt="";//拼接字符串；
    txt="order_id="+order_id4;
    var url = local+":8080/stockorder/orderChangeTo3";//服务器URL
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    alert("订单已收货");
}
function comfirmPro5() {

    var xmlHttp = creatxmlHTTP1();
    //获取主页的用户
    var txt="";//拼接字符串；
    txt="order_id="+order_id5;
    var url = local+":8080/stockorder/orderChangeTo3";//服务器URL
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    alert("订单已收货");
}
function comfirmPro6() {

    var xmlHttp = creatxmlHTTP1();
    //获取主页的用户
    var txt="";//拼接字符串；
    txt="order_id="+order_id6;
    var url = local+":8080/stockorder/orderChangeTo3";//服务器URL
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);
    alert("订单已收货");
}
function creatxmlHTTP1() {
    if(window.XMLHttpRequest){
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
        xmlHttp=new XMLHttpRequest();
    }else {
        // IE6, IE5 浏览器执行代码
        xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
    return xmlHttp;
}




function nextPage_bid_decision() {
    page++;
    if(totalPages>page){

        onClickAjax1();
    }
    else alert("已经是最后一页");
}


function beforePage_bid_decision() {
    page--;
    if(page>=0){
        onClickAjax1();
    }
    else alert("第一页");
}



function payOnload(){
    var sum=getval;
    document.getElementById('pay1').value=getval;
    document.getElementById('pay2').value=sum;
}

function stockCookie1() {
    // var input1 = document.getElementsByName("Bid1");
    // setCookie('stock_productname1',input1[2].value,1);
    // setCookie('stock_ordercode1',input1[0].value,1);
    // setCookie('stock_product_model1',input1[3].value,1);
    // setCookie('stock_size1',input1[4].value,1);
    // setCookie('stock_brand1',input1[5].value,1);
    // setCookie('stock_sale_price1',input1[6].value,1);
    // setCookie('stock_product_qty1',input1[7].value,1);
    // setCookie('stock_total1',input1[2].value,1);
    // getUserInfo(userId)
    // var input2 = document.getElementsByName("Bid2");
    //
    // var input3 = document.getElementsByName("Bid3");
    // var input4 = document.getElementsByName("Bid4");
    // var input5 = document.getElementsByName("Bid5");
    // var input6 = document.getElementsByName("Bid6");


    var keyId = getCookie('userId');
    xmlHttp = creatxmlHTTP211();
    var txt = "";//用于存储拼接字符串；
    var url = local + ":8080/importOrder/importOrder";
    //拼接字符
    txt = "order_Id=" + order_id1;
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);

    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var result = xmlHttp.responseText;
            var json = eval("(" + result + ")");

            var keyId = json.data.keyId;
            var product_name = json.data.product_name;
            var buy_CompanyName = json.data.buy_CompanyName;
            var sell_CompanyName = json.data.sell_CompanyName;
            var inventory = json.data.inventory;
            var size = json.data.size;
            var model_code = json.data.model_code;
            var sigle_price = json.data.sigle_price;
            var total_price = json.data.total_price;
            var brand = json.data.brand;

            setCookie('stock_keyId', keyId, 1);
            setCookie('stock_productname', product_name, 1);
            setCookie('stock_buycompanyname', buy_CompanyName, 1);
            setCookie('stock_sellcompanyname', sell_CompanyName, 1);
            setCookie('stock_inventory', inventory, 1);
            setCookie('stock_size', size, 1);
            setCookie('stock_model_code', model_code, 1);
            setCookie('stock_sale_price', sigle_price, 1);
            setCookie('stock_total_price', total_price, 1);
            setCookie('brand', brand, 1);
        }

        function creatxmlHTTP211() {
            if (window.XMLHttpRequest) {
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                xmlHttp = new XMLHttpRequest();
            } else {
                // IE6, IE5 浏览器执行代码
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            return xmlHttp;
        }

    }

}

function stockCookie2() {
    // var input1 = document.getElementsByName("Bid1");
    // setCookie('stock_productname1',input1[2].value,1);
    // setCookie('stock_ordercode1',input1[0].value,1);
    // setCookie('stock_product_model1',input1[3].value,1);
    // setCookie('stock_size1',input1[4].value,1);
    // setCookie('stock_brand1',input1[5].value,1);
    // setCookie('stock_sale_price1',input1[6].value,1);
    // setCookie('stock_product_qty1',input1[7].value,1);
    // setCookie('stock_total1',input1[2].value,1);
    // getUserInfo(userId)
    // var input2 = document.getElementsByName("Bid2");
    //
    // var input3 = document.getElementsByName("Bid3");
    // var input4 = document.getElementsByName("Bid4");
    // var input5 = document.getElementsByName("Bid5");
    // var input6 = document.getElementsByName("Bid6");


    var keyId = getCookie('userId');
    xmlHttp = creatxmlHTTP211();
    var txt = "";//用于存储拼接字符串；
    var url = local + ":8080/importOrder/importOrder";
    //拼接字符
    txt = "order_Id=" + order_id2;
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);

    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var result = xmlHttp.responseText;
            var json = eval("(" + result + ")");

            var keyId = json.data.keyId;
            var product_name = json.data.product_name;
            var buy_CompanyName = json.data.buy_CompanyName;
            var sell_CompanyName = json.data.sell_CompanyName;
            var inventory = json.data.inventory;
            var size = json.data.size;
            var model_code = json.data.model_code;
            var sigle_price = json.data.sigle_price;
            var total_price = json.data.total_price;
            var brand = json.data.brand;

            setCookie('stock_keyId', keyId, 1);
            setCookie('stock_productname', product_name, 1);
            setCookie('stock_buycompanyname', buy_CompanyName, 1);
            setCookie('stock_sellcompanyname', sell_CompanyName, 1);
            setCookie('stock_inventory', inventory, 1);
            setCookie('stock_size', size, 1);
            setCookie('stock_model_code', model_code, 1);
            setCookie('stock_sale_price', sigle_price, 1);
            setCookie('stock_total_price', total_price, 1);
            setCookie('brand', brand, 1);
        }

        function creatxmlHTTP211() {
            if (window.XMLHttpRequest) {
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                xmlHttp = new XMLHttpRequest();
            } else {
                // IE6, IE5 浏览器执行代码
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            return xmlHttp;
        }

    }

}

function stockCookie3() {
    // var input1 = document.getElementsByName("Bid1");
    // setCookie('stock_productname1',input1[2].value,1);
    // setCookie('stock_ordercode1',input1[0].value,1);
    // setCookie('stock_product_model1',input1[3].value,1);
    // setCookie('stock_size1',input1[4].value,1);
    // setCookie('stock_brand1',input1[5].value,1);
    // setCookie('stock_sale_price1',input1[6].value,1);
    // setCookie('stock_product_qty1',input1[7].value,1);
    // setCookie('stock_total1',input1[2].value,1);
    // getUserInfo(userId)
    // var input2 = document.getElementsByName("Bid2");
    //
    // var input3 = document.getElementsByName("Bid3");
    // var input4 = document.getElementsByName("Bid4");
    // var input5 = document.getElementsByName("Bid5");
    // var input6 = document.getElementsByName("Bid6");


    var keyId = getCookie('userId');
    xmlHttp = creatxmlHTTP211();
    var txt = "";//用于存储拼接字符串；
    var url = local + ":8080/importOrder/importOrder";
    //拼接字符
    txt = "order_Id=" + order_id3;
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);

    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var result = xmlHttp.responseText;
            var json = eval("(" + result + ")");

            var keyId = json.data.keyId;
            var product_name = json.data.product_name;
            var buy_CompanyName = json.data.buy_CompanyName;
            var sell_CompanyName = json.data.sell_CompanyName;
            var inventory = json.data.inventory;
            var size = json.data.size;
            var model_code = json.data.model_code;
            var sigle_price = json.data.sigle_price;
            var total_price = json.data.total_price;
            var brand = json.data.brand;

            setCookie('stock_keyId', keyId, 1);
            setCookie('stock_productname', product_name, 1);
            setCookie('stock_buycompanyname', buy_CompanyName, 1);
            setCookie('stock_sellcompanyname', sell_CompanyName, 1);
            setCookie('stock_inventory', inventory, 1);
            setCookie('stock_size', size, 1);
            setCookie('stock_model_code', model_code, 1);
            setCookie('stock_sale_price', sigle_price, 1);
            setCookie('stock_total_price', total_price, 1);
            setCookie('brand', brand, 1);
        }

        function creatxmlHTTP211() {
            if (window.XMLHttpRequest) {
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                xmlHttp = new XMLHttpRequest();
            } else {
                // IE6, IE5 浏览器执行代码
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            return xmlHttp;
        }

    }

}

function stockCookie4() {
    // var input1 = document.getElementsByName("Bid1");
    // setCookie('stock_productname1',input1[2].value,1);
    // setCookie('stock_ordercode1',input1[0].value,1);
    // setCookie('stock_product_model1',input1[3].value,1);
    // setCookie('stock_size1',input1[4].value,1);
    // setCookie('stock_brand1',input1[5].value,1);
    // setCookie('stock_sale_price1',input1[6].value,1);
    // setCookie('stock_product_qty1',input1[7].value,1);
    // setCookie('stock_total1',input1[2].value,1);
    // getUserInfo(userId)
    // var input2 = document.getElementsByName("Bid2");
    //
    // var input3 = document.getElementsByName("Bid3");
    // var input4 = document.getElementsByName("Bid4");
    // var input5 = document.getElementsByName("Bid5");
    // var input6 = document.getElementsByName("Bid6");


    var keyId = getCookie('userId');
    xmlHttp = creatxmlHTTP211();
    var txt = "";//用于存储拼接字符串；
    var url = local + ":8080/importOrder/importOrder";
    //拼接字符
    txt = "order_Id=" + order_id4;
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);

    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var result = xmlHttp.responseText;
            var json = eval("(" + result + ")");

            var keyId = json.data.keyId;
            var product_name = json.data.product_name;
            var buy_CompanyName = json.data.buy_CompanyName;
            var sell_CompanyName = json.data.sell_CompanyName;
            var inventory = json.data.inventory;
            var size = json.data.size;
            var model_code = json.data.model_code;
            var sigle_price = json.data.sigle_price;
            var total_price = json.data.total_price;
            var brand = json.data.brand;

            setCookie('stock_keyId', keyId, 1);
            setCookie('stock_productname', product_name, 1);
            setCookie('stock_buycompanyname', buy_CompanyName, 1);
            setCookie('stock_sellcompanyname', sell_CompanyName, 1);
            setCookie('stock_inventory', inventory, 1);
            setCookie('stock_size', size, 1);
            setCookie('stock_model_code', model_code, 1);
            setCookie('stock_sale_price', sigle_price, 1);
            setCookie('stock_total_price', total_price, 1);
            setCookie('brand', brand, 1);
        }

        function creatxmlHTTP211() {
            if (window.XMLHttpRequest) {
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                xmlHttp = new XMLHttpRequest();
            } else {
                // IE6, IE5 浏览器执行代码
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            return xmlHttp;
        }

    }

}

function stockCookie5() {
    // var input1 = document.getElementsByName("Bid1");
    // setCookie('stock_productname1',input1[2].value,1);
    // setCookie('stock_ordercode1',input1[0].value,1);
    // setCookie('stock_product_model1',input1[3].value,1);
    // setCookie('stock_size1',input1[4].value,1);
    // setCookie('stock_brand1',input1[5].value,1);
    // setCookie('stock_sale_price1',input1[6].value,1);
    // setCookie('stock_product_qty1',input1[7].value,1);
    // setCookie('stock_total1',input1[2].value,1);
    // getUserInfo(userId)
    // var input2 = document.getElementsByName("Bid2");
    //
    // var input3 = document.getElementsByName("Bid3");
    // var input4 = document.getElementsByName("Bid4");
    // var input5 = document.getElementsByName("Bid5");
    // var input6 = document.getElementsByName("Bid6");


    var keyId = getCookie('userId');
    xmlHttp = creatxmlHTTP211();
    var txt = "";//用于存储拼接字符串；
    var url = local + ":8080/importOrder/importOrder";
    //拼接字符
    txt = "order_Id=" + order_id5;
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);

    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var result = xmlHttp.responseText;
            var json = eval("(" + result + ")");

            var keyId = json.data.keyId;
            var product_name = json.data.product_name;
            var buy_CompanyName = json.data.buy_CompanyName;
            var sell_CompanyName = json.data.sell_CompanyName;
            var inventory = json.data.inventory;
            var size = json.data.size;
            var model_code = json.data.model_code;
            var sigle_price = json.data.sigle_price;
            var total_price = json.data.total_price;
            var brand = json.data.brand;

            setCookie('stock_keyId', keyId, 1);
            setCookie('stock_productname', product_name, 1);
            setCookie('stock_buycompanyname', buy_CompanyName, 1);
            setCookie('stock_sellcompanyname', sell_CompanyName, 1);
            setCookie('stock_inventory', inventory, 1);
            setCookie('stock_size', size, 1);
            setCookie('stock_model_code', model_code, 1);
            setCookie('stock_sale_price', sigle_price, 1);
            setCookie('stock_total_price', total_price, 1);
            setCookie('brand', brand, 1);
        }

        function creatxmlHTTP211() {
            if (window.XMLHttpRequest) {
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                xmlHttp = new XMLHttpRequest();
            } else {
                // IE6, IE5 浏览器执行代码
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            return xmlHttp;
        }

    }

}

function stockCookie6() {
    // var input1 = document.getElementsByName("Bid1");
    // setCookie('stock_productname1',input1[2].value,1);
    // setCookie('stock_ordercode1',input1[0].value,1);
    // setCookie('stock_product_model1',input1[3].value,1);
    // setCookie('stock_size1',input1[4].value,1);
    // setCookie('stock_brand1',input1[5].value,1);
    // setCookie('stock_sale_price1',input1[6].value,1);
    // setCookie('stock_product_qty1',input1[7].value,1);
    // setCookie('stock_total1',input1[2].value,1);
    // getUserInfo(userId)
    // var input2 = document.getElementsByName("Bid2");
    //
    // var input3 = document.getElementsByName("Bid3");
    // var input4 = document.getElementsByName("Bid4");
    // var input5 = document.getElementsByName("Bid5");
    // var input6 = document.getElementsByName("Bid6");


    var keyId = getCookie('userId');
    xmlHttp = creatxmlHTTP211();
    var txt = "";//用于存储拼接字符串；
    var url = local + ":8080/importOrder/importOrder";
    //拼接字符
    txt = "order_Id=" + order_id6;
    xmlHttp.open("POST", url, true);
    xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xmlHttp.send(txt);

    xmlHttp.onreadystatechange = function () {
        if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
            var result = xmlHttp.responseText;
            var json = eval("(" + result + ")");

            var keyId = json.data.keyId;
            var product_name = json.data.product_name;
            var buy_CompanyName = json.data.buy_CompanyName;
            var sell_CompanyName = json.data.sell_CompanyName;
            var inventory = json.data.inventory;
            var size = json.data.size;
            var model_code = json.data.model_code;
            var sigle_price = json.data.sigle_price;
            var total_price = json.data.total_price;
            var brand = json.data.brand;

            setCookie('stock_keyId', keyId, 1);
            setCookie('stock_productname', product_name, 1);
            setCookie('stock_buycompanyname', buy_CompanyName, 1);
            setCookie('stock_sellcompanyname', sell_CompanyName, 1);
            setCookie('stock_inventory', inventory, 1);
            setCookie('stock_size', size, 1);
            setCookie('stock_model_code', model_code, 1);
            setCookie('stock_sale_price', sigle_price, 1);
            setCookie('stock_total_price', total_price, 1);
            setCookie('brand', brand, 1);
        }

        function creatxmlHTTP211() {
            if (window.XMLHttpRequest) {
//  IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
                xmlHttp = new XMLHttpRequest();
            } else {
                // IE6, IE5 浏览器执行代码
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            return xmlHttp;
        }

    }

}




function setCookie(c_name,value,expiredays)
{
    var exdate=new Date();
    exdate.setDate(exdate.getDate()+expiredays);
    document.cookie=c_name+ "=" +escape(value)+
        ((expiredays==null) ? "" : ";expires="+exdate.toGMTString())+";path=/";
}
function getCookie(c_name)
{
    if (document.cookie.length>0)
    {
        c_start=document.cookie.indexOf(c_name + "=")
        if (c_start!=-1)
        {
            c_start=c_start + c_name.length+1
            c_end=document.cookie.indexOf(";",c_start)
            if (c_end==-1) c_end=document.cookie.length
            return unescape(document.cookie.substring(c_start,c_end))
        }
    }
    return ""
}

function clearCookie(name) {
    setCookie(name, "", -1);
}

$( document ).ready(function() {

    onClickAjax1();
    getInvite();

});






